package com.demo.utils;

public class TimeUtils {
	private static boolean flg = false;
	private static long start;
	private static long end;
	
	public static void startTime() {
		flg = true;
		start = System.currentTimeMillis();
	}
	
	public static long end() {
		if (!flg) {
			throw new RuntimeException("先执行startTime");
		}
		end = System.currentTimeMillis();
		return end - start;
	}
	
	public static void endAndPrimtime() {
		long time = end();
		System.out.println("total time:"+time+"ms");
	}
	
	
	
}
